<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" type="text/css" href="/Public/app/css/main.css" />
	<title>中奖纪录</title>

	<link rel="stylesheet" href="/Public/libs/layer/need/layer.css">
	<link rel="stylesheet" href="/Public/app/css/app.css">
	<script src="/Public/libs/jquery-1.9.1.min.js"></script>
	<script src="/Public/libs/jquery.getParame.js"></script>
	<script src="/Public/libs/store.legacy.min.js"></script>
	<script src="/Public/libs/vconsole.min.js"></script>
	<script src="/Public/libs/layer/layer.js"></script>
	<script src="/Public/libs/jrender.min.js"></script>
</head>

<body style="background: #FFF;">
	<div class="yyybg">
		<img src="/Public/app/images/shake/zjjl-head.png" />
		<h3>年会活动</h3>
	</div>
	<div class="footer-div">
		<img src="/Public/app/images/shake/footer-bg.png" />
	</div>
	<div class="cyxx">
		<p>
			<span>中奖纪录</span>
			<time></time>
		</p>
	</div>
	<div class="zjxx">
		<ul class="j-specCard-box">

		</ul>
		<script type="text/x-jsrender" id="j-specCard">
			<%for%>
				<li>
					<i>
						<img src="<%:userInfo.user_headimgurl%>" />
					</i>
					<p class="nameAndTime">
						<span>
							<%if userInfo.user_nickname%>
								<%:userInfo.user_nickname%>
									<%else%>
										未设置昵称
										<%/if%>
						</span>
						<time>
							<%:create_time%>
						</time>
					</p>
					<p class="jp">
						<span>
							<%if winning_type == 1%>
								抽奖活动
								<%else winning_type == 2%>
									摇一摇活动
									<%else%>
										其他活动
										<%/if%>
						</span>
						<br>
						<span>
							<%if winning_type == 1%>
								获奖
								<%else winning_type == 2%>
									第
									<%:winning_rank%>名
										<%else%>
											获奖
											<%/if%>

						</span>
					</p>
				</li>
				<%/for%>
		</script>

	</div>

</body>

<!-- <div class="j-specCard-box">

</div>
<script type="text/x-jsrender" id="j-specCard">
	<%for%>
		<a type="button" class="btn table-num-btn" talbeId="<%:table_id%>">
			<%:table_id%>号桌
		</a>
		<%/for%>
</script> -->

<script>
	$(function () {
		
		if (!store.get('cj__openid')) {
			layer.closeAll();

			layer.open({
				content: '未签到',
				btn: '请签到',
				shadeClose: false,
				yes: function () {
					window.location.replace(
						'/index.php');

				}
			})
			return false;
		}

		// 设置 jquery 模版引擎参数
		$.views.settings.delimiters("<%", "%>");

		layer.open({
			shadeClose: false,
			type: 2,
			content: '加载中'
		});
		$.ajax({
			type: 'POST',
			url: '/index.php/Active/getdrawbyopenid',
			data: {
				openid: store.get('cj__openid'),
			},
			success: function (data) {
				console.log(data);
				if (data['return_code'] == 1) {

					jsRenderTpl = $.templates('#j-specCard');
					finalTpl = jsRenderTpl(data.return_body);
					$('.j-specCard-box').html(finalTpl);

					//删除所有layer层
					layer.closeAll();
				} else {
					//删除所有layer
					layer.closeAll();

					//信息框
					layer.open({
						content: data['return_msg'],
						btn: '关闭'
					});
				}
			},
			error: function (err) {
				console.log(err);
				//删除所有layer层
				layer.closeAll();
				//信息框
				layer.open({
					content: '服务器出了点问题',
					btn: '关闭'
				});
			}
		})

	})
</script>

</html>